<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>PDF文件预览</title>
  <link rel="stylesheet" href="./css/index.css">
  <script src="./js/jquery-1.9.1.min.js"></script>
  <script src="./js/pdf.js/build/pdf.js"></script>

  <script type="text/JavaScript">
    $(function () {
      // $(document).ready(function(){  
      //   $(document).bind("contextmenu",function(e){   
      //     return false;   
      //   });
      // });
      // var thisURL = document.URL; 
      // var getval = thisURL.split('?')[1]; 
      // var this_url = getval.split("=")[1];
      var thisURL = document.URL; 
      var getval = thisURL.split('?')[1];
      var item = getval.split("=");
      var id = item[1]
      var itemId = item[3]
      var this_url = item[5]
      // id = 31
      // appendix1 = "/guangdong/1.pdf"
      // appendix2 = "/guangdong/2.pdf"
      // appendix3 = "/guangdong/3.pdf"
      // appendix4 = "/guangdong/4.pdf"
      // appendix5 = "/guangdong/5.pdf"

      // id = 32
      // appendix1 = "/henan/1.pdf"
      // appendix2 = "/henan/2.pdf"
      // appendix3 = "/henan/3.pdf"
      // appendix4 = "/henan/4.pdf"
      // appendix5 = "/henan/5.pdf"

      
      if (id == '31') {
        switch(itemId){
          case '1':
            this_url = '/guangdong/1.pdf';
            break;
          case '2':
            this_url = '/guangdong/2.pdf';
            break;
          case '3':
            this_url = '/guangdong/3.pdf';
            break;
          case '4':
            this_url = '/guangdong/4.pdf';
            break;
          case '5':
            this_url = '/guangdong/5.pdf';
            break;
          default:
          break;
        }
      } else if (id == '32') {
        switch(itemId){
          case '1':
            this_url = '/henan/1.pdf';
            break;
          case '2':
            this_url = '/henan/2.pdf';
            break;
          case '3':
            this_url = '/henan/3.pdf';
            break;
          case '4':
            this_url = '/henan/4.pdf';
            break;
          case '5':
            this_url = '/henan/5.pdf';
            break;
          default:
          break;
        }
      }
      // console.log('文件名', this_url);
      
      $("#pdfContainer").attr("src", './js/pdf.js/web/viewer.html?file=https://test.twzcloud.com/meeting/acc-api/city/pdf?appendix='+ this_url +'#page=1');
      // 内网
      // $("#pdfContainer").attr("src", './js/pdf.js/web/viewer.html?file=https://expert.most.gov.cn/meeting/acc-api/city/pdf?appendix='+ this_url +'#page=1');
      });
  </script>
</head>

<body>
  <div id="showPdf">
    <iframe id="pdfContainer" src="" width="100%" height="100%" frameborder="0"></iframe>
  </div>
</body>
<script type="text/javascript">
  document.oncontextmenu=new Function("event.returnValue=false;");
  document.onselectstart=new Function("event.returnValue=false;");
</script>

</html>